package com.dt76.smallloanbackendservice.service.zjs.impl;

import com.dt76.smallloanbackendservice.mapper.zjs.BlackUserMapper;
import com.dt76.smallloanbackendservice.pojo.zjs.BlackUser;
import com.dt76.smallloanbackendservice.service.zjs.BlackUserService;
import com.dt76.smallloanbackendservice.utils.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class BlackUserServiceImpl implements BlackUserService {

    @Autowired
    private BlackUserMapper blackUserMapper;
    @Override
    public List<BlackUser> qryAllBlackUser() {
       return blackUserMapper.qryAllBlackUser();
    }

    @Override
    public Page qryPageAllBlackUser(int pageIndex, String queryname, int userId) {
        Page page = new Page();
        page.setPageIndex(pageIndex);//每次更新当前页
        //更新总条数
        page.setTotalCount(blackUserMapper.qryCount(queryname,userId));
        List<BlackUser> blackUserList =  blackUserMapper.qryPageAllBlackUser(
                (page.getPageIndex()-1)*page.getPageSize(),
                page.getPageSize(),queryname,userId);
        page.setRows(blackUserList);
        return page;
    }

    @Override
    public void delBlackUser(int userId) { blackUserMapper.delBlackUser(userId); }
}
